project(
  'toml-test',
)

go = find_program('go', required: false)
if go.found()
  go_wrapper = find_program(files('go-wrapper.py'))
  toml_test_exe = find_program(
    configure_file(
      command: [
        go_wrapper, meson.current_source_dir(),
        go, 'build',
        '-pkgdir', meson.current_build_dir(),
        '-o', '@OUTPUT@',
        '-v', '-x',
        './cmd/toml-test',
      ],
      output: 'toml-test',
    ),
    'toml-test',
    required: false,
  )
else
  toml_test_exe = disabler()
endif

compliance_tests = meson.current_source_dir() / 'tests'

valid_tests = [
  'valid/array/array',
  'valid/array/bool',
  'valid/array/empty',
  'valid/array/hetergeneous',
  'valid/array/mixed-int-array',
  'valid/array/mixed-int-float',
  'valid/array/mixed-int-string',
  'valid/array/mixed-string-table',
  'valid/array/nested-double',
  'valid/array/nested-inline-table',
  'valid/array/nested',
  'valid/array/nospaces',
  'valid/array/string-quote-comma-2',
  'valid/array/string-quote-comma',
  'valid/array/string-with-comma',
  'valid/array/strings',
  'valid/array/table-array-string-backslash',
  'valid/bool/bool',
  'valid/comment/at-eof',
  'valid/comment/at-eof2',
  'valid/comment/everywhere',
  'valid/comment/noeol',
  'valid/comment/tricky',
  'valid/datetime/datetime',
  'valid/datetime/local-date',
  'valid/datetime/local-time',
  'valid/datetime/local',
  'valid/datetime/milliseconds',
  'valid/datetime/timezone',
  'valid/empty-file',
  'valid/example',
  'valid/float/exponent',
  'valid/float/float',
  'valid/float/inf-and-nan',
  'valid/float/long',
  'valid/float/underscore',
  'valid/float/zero',
  'valid/implicit-and-explicit-after',
  'valid/implicit-and-explicit-before',
  'valid/implicit-groups',
  'valid/inline-table/array',
  'valid/inline-table/bool',
  'valid/inline-table/empty',
  'valid/inline-table/end-in-bool',
  'valid/inline-table/inline-table',
  'valid/inline-table/key-dotted',
  'valid/inline-table/multiline',
  'valid/inline-table/nest',
  'valid/integer/integer',
  'valid/integer/literals',
  'valid/integer/long',
  'valid/integer/underscore',
  'valid/integer/zero',
  'valid/key/alphanum',
  'valid/key/case-sensitive',
  'valid/key/dotted',
  'valid/key/empty',
  'valid/key/equals-nospace',
  'valid/key/escapes',
  'valid/key/numeric-dotted',
  'valid/key/numeric',
  'valid/key/quoted-dots',
  'valid/key/space',
  'valid/key/special-chars',
  'valid/key/special-word',
  'valid/newline-crlf',
  'valid/newline-lf',
  'valid/spec-example-1-compact',
  'valid/spec-example-1',
  'valid/string/double-quote-escape',
  'valid/string/empty',
  'valid/string/escape-tricky',
  'valid/string/escaped-escape',
  'valid/string/escapes',
  'valid/string/multiline-escaped-crlf',
  'valid/string/multiline-quotes',
  'valid/string/multiline',
  'valid/string/nl',
  'valid/string/raw-multiline',
  'valid/string/raw',
  'valid/string/simple',
  'valid/string/unicode-escape',
  'valid/string/unicode-literal',
  'valid/string/with-pound',
  'valid/table/array-implicit',
  'valid/table/array-many',
  'valid/table/array-nest',
  'valid/table/array-one',
  'valid/table/array-table-array',
  'valid/table/empty',
  'valid/table/keyword',
  'valid/table/names',
  'valid/table/no-eol',
  'valid/table/sub-empty',
  'valid/table/whitespace',
  'valid/table/with-literal-string',
  'valid/table/with-pound',
  'valid/table/with-single-quotes',
  'valid/table/without-super',
]

invalid_tests = [
  'invalid/array/missing-separator',
  'invalid/array/no-close-2',
  'invalid/array/no-close-table-2',
  'invalid/array/no-close-table',
  'invalid/array/no-close',
  'invalid/array/tables-1',
  'invalid/array/tables-2',
  'invalid/array/text-after-array-entries',
  'invalid/array/text-before-array-separator',
  'invalid/array/text-in-array',
  'invalid/bool/mixed-case',
  'invalid/bool/wrong-case-false',
  'invalid/bool/wrong-case-true',
  'invalid/control/bare-cr',
  'invalid/control/bare-formfeed',
  'invalid/control/bare-null',
  'invalid/control/bare-vertical-tab',
  'invalid/control/comment-cr',
  'invalid/control/comment-del',
  'invalid/control/comment-lf',
  'invalid/control/comment-null',
  'invalid/control/comment-us',
  'invalid/control/multi-del',
  'invalid/control/multi-lf',
  'invalid/control/multi-null',
  'invalid/control/multi-us',
  'invalid/control/rawmulti-del',
  'invalid/control/rawmulti-lf',
  'invalid/control/rawmulti-null',
  'invalid/control/rawmulti-us',
  'invalid/control/rawstring-del',
  'invalid/control/rawstring-lf',
  'invalid/control/rawstring-null',
  'invalid/control/rawstring-us',
  'invalid/control/string-bs',
  'invalid/control/string-del',
  'invalid/control/string-lf',
  'invalid/control/string-null',
  'invalid/control/string-us',
  'invalid/datetime/hour-over',
  'invalid/datetime/mday-over',
  'invalid/datetime/mday-under',
  'invalid/datetime/minute-over',
  'invalid/datetime/month-over',
  'invalid/datetime/month-under',
  'invalid/datetime/no-leads-with-milli',
  'invalid/datetime/no-leads',
  'invalid/datetime/no-secs',
  'invalid/datetime/no-t',
  'invalid/datetime/second-over',
  'invalid/datetime/time-no-leads-2',
  'invalid/datetime/time-no-leads',
  'invalid/datetime/trailing-t',
  'invalid/encoding/bad-utf8-at-end',
  'invalid/encoding/bad-utf8-in-comment',
  'invalid/encoding/bad-utf8-in-string',
  'invalid/encoding/bom-not-at-start-1',
  'invalid/encoding/bom-not-at-start-2',
  'invalid/encoding/utf16-bom',
  'invalid/encoding/utf16',
  'invalid/float/double-point-1',
  'invalid/float/double-point-2',
  'invalid/float/exp-double-e-1',
  'invalid/float/exp-double-e-2',
  'invalid/float/exp-double-us',
  'invalid/float/exp-leading-us',
  'invalid/float/exp-point-1',
  'invalid/float/exp-point-2',
  'invalid/float/exp-trailing-us',
  'invalid/float/inf-incomplete-1',
  'invalid/float/inf-incomplete-2',
  'invalid/float/inf-incomplete-3',
  'invalid/float/inf_underscore',
  'invalid/float/leading-point-neg',
  'invalid/float/leading-point-plus',
  'invalid/float/leading-point',
  'invalid/float/leading-us',
  'invalid/float/leading-zero-neg',
  'invalid/float/leading-zero-plus',
  'invalid/float/leading-zero',
  'invalid/float/nan-incomplete-1',
  'invalid/float/nan-incomplete-2',
  'invalid/float/nan-incomplete-3',
  'invalid/float/nan_underscore',
  'invalid/float/trailing-point-min',
  'invalid/float/trailing-point-plus',
  'invalid/float/trailing-point',
  'invalid/float/trailing-us-exp',
  'invalid/float/trailing-us',
  'invalid/float/us-after-point',
  'invalid/float/us-before-point',
  'invalid/inline-table/add',
  'invalid/inline-table/double-comma',
  'invalid/inline-table/duplicate-key',
  'invalid/inline-table/empty',
  'invalid/inline-table/linebreak-1',
  'invalid/inline-table/linebreak-2',
  'invalid/inline-table/linebreak-3',
  'invalid/inline-table/linebreak-4',
  'invalid/inline-table/no-comma',
  'invalid/inline-table/overwrite',
  'invalid/inline-table/trailing-comma',
  'invalid/integer/capital-bin',
  'invalid/integer/capital-hex',
  'invalid/integer/capital-oct',
  'invalid/integer/double-sign-nex',
  'invalid/integer/double-sign-plus',
  'invalid/integer/double-us',
  'invalid/integer/incomplete-bin',
  'invalid/integer/incomplete-hex',
  'invalid/integer/incomplete-oct',
  'invalid/integer/invalid-bin',
  'invalid/integer/invalid-hex',
  'invalid/integer/invalid-oct',
  'invalid/integer/leading-us-bin',
  'invalid/integer/leading-us-hex',
  'invalid/integer/leading-us-oct',
  'invalid/integer/leading-us',
  'invalid/integer/leading-zero-1',
  'invalid/integer/leading-zero-2',
  'invalid/integer/leading-zero-3',
  'invalid/integer/leading-zero-sign-1',
  'invalid/integer/leading-zero-sign-2',
  'invalid/integer/leading-zero-sign-3',
  'invalid/integer/negative-bin',
  'invalid/integer/negative-hex',
  'invalid/integer/negative-oct',
  'invalid/integer/positive-bin',
  'invalid/integer/positive-hex',
  'invalid/integer/positive-oct',
  'invalid/integer/text-after-integer',
  'invalid/integer/trailing-us-bin',
  'invalid/integer/trailing-us-hex',
  'invalid/integer/trailing-us-oct',
  'invalid/integer/trailing-us',
  'invalid/integer/us-after-bin',
  'invalid/integer/us-after-hex',
  'invalid/integer/us-after-oct',
  'invalid/key/after-array',
  'invalid/key/after-table',
  'invalid/key/after-value',
  'invalid/key/bare-invalid-character',
  'invalid/key/dotted-redefine-table',
  'invalid/key/duplicate-keys',
  'invalid/key/duplicate',
  'invalid/key/empty',
  'invalid/key/escape',
  'invalid/key/hash',
  'invalid/key/multiline',
  'invalid/key/newline',
  'invalid/key/no-eol',
  'invalid/key/open-bracket',
  'invalid/key/partial-quoted',
  'invalid/key/single-open-bracket',
  'invalid/key/space',
  'invalid/key/special-character',
  'invalid/key/start-bracket',
  'invalid/key/two-equals',
  'invalid/key/two-equals2',
  'invalid/key/two-equals3',
  'invalid/key/without-value-1',
  'invalid/key/without-value-2',
  'invalid/string/bad-byte-escape',
  'invalid/string/bad-codepoint',
  'invalid/string/bad-concat',
  'invalid/string/bad-escape-1',
  'invalid/string/bad-escape-2',
  'invalid/string/bad-multiline',
  'invalid/string/bad-slash-escape',
  'invalid/string/bad-uni-esc',
  'invalid/string/basic-byte-escapes',
  'invalid/string/basic-multiline-out-of-range-unicode-escape-1',
  'invalid/string/basic-multiline-out-of-range-unicode-escape-2',
  'invalid/string/basic-multiline-quotes',
  'invalid/string/basic-multiline-unknown-escape',
  'invalid/string/basic-out-of-range-unicode-escape-1',
  'invalid/string/basic-out-of-range-unicode-escape-2',
  'invalid/string/basic-unknown-escape',
  'invalid/string/literal-multiline-quotes-1',
  'invalid/string/literal-multiline-quotes-2',
  'invalid/string/missing-quotes',
  'invalid/string/multiline-bad-escape-1',
  'invalid/string/multiline-bad-escape-2',
  'invalid/string/multiline-bad-escape-3',
  'invalid/string/multiline-escape-space',
  'invalid/string/multiline-no-close-2',
  'invalid/string/multiline-no-close',
  'invalid/string/multiline-quotes-1',
  'invalid/string/no-close',
  'invalid/string/text-after-string',
  'invalid/string/wrong-close',
  'invalid/table/append-with-dotted-keys-1',
  'invalid/table/append-with-dotted-keys-2',
  'invalid/table/array-empty',
  'invalid/table/array-implicit',
  'invalid/table/array-missing-bracket',
  'invalid/table/duplicate-key-dotted-table',
  'invalid/table/duplicate-key-dotted-table2',
  'invalid/table/duplicate-key-table',
  'invalid/table/duplicate-table-array',
  'invalid/table/duplicate-table-array2',
  'invalid/table/duplicate',
  'invalid/table/empty-implicit-table',
  'invalid/table/empty',
  'invalid/table/equals-sign',
  'invalid/table/llbrace',
  'invalid/table/nested-brackets-close',
  'invalid/table/nested-brackets-open',
  'invalid/table/quoted-no-close',
  'invalid/table/redefine',
  'invalid/table/rrbrace',
  'invalid/table/text-after-table',
  'invalid/table/whitespace',
  'invalid/table/with-pound',
]
